using System;
using System.Globalization;
using Avalonia.Data.Converters;
using Avalonia.Media;

namespace IntegratedMeasuring.Utils;

public class LevelToColorConverter : IValueConverter
{
    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        if (value == null) return Brushes.Black;
        var level = value.ToString();
        return level switch
        {
            "INFO" => new SolidColorBrush(Color.Parse("#007BFF")),
            "WARNING" => new SolidColorBrush(Color.Parse("#FFA500")),
            "PRIMARY" => new SolidColorBrush(Color.Parse("#28A745")),
            "ERROR" => new SolidColorBrush(Color.Parse("#DC3545")),
            _ => Brushes.Black
        };
    }

    public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException();
} 